package com.listeningframework.boot.autoconfigure.webservice;

import javax.annotation.PostConstruct;
import javax.servlet.ServletRegistration;

import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.spring.SpringComponentProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 
 * Jersey Configuration
 *
 * @author lixining
 * @version $Id: JerseyConfiguration.java, v 0.1 2016年7月15日 下午2:02:57 lixining Exp $
 */
@Configuration
@ConditionalOnWebApplication
@ConditionalOnBean({ ResourceConfig.class })
@ConditionalOnClass({ SpringComponentProvider.class, ServletRegistration.class })
public class ListeningJerseyConfiguration {
    /**
     * ListeningResourceConfig
     *
     * @return ListeningJerseyResourceConfig
     */
    @Bean
    public ListeningJerseyResourceConfig getListeningResourceConfig() {
        return new ListeningJerseyResourceConfig();
    }

    /**
     * 
     * Listening Jersey Resource Config
     *
     * @author lixining
     * @version $Id: ListeningJerseyConfiguration.java, v 0.1 2016年7月15日 下午2:06:57 lixining Exp $
     */
    public class ListeningJerseyResourceConfig extends ResourceConfig {

        @PostConstruct
        public void registerJerseyConfig() {
            System.err.println("=============>test");
        }
    }
}
